package com.mdd.admin.validate.session;

import com.mdd.common.validator.annotation.IDMust;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 用户会话参数
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class UserSessionParam implements Serializable {

    private static final long serialVersionUID = 1L;

    public interface create{}
    public interface update{}
    public interface delete{}

    @IDMust(message = "id参数必传且需大于0", groups = {update.class, delete.class})
    private Long id;

    @NotNull(message = "userId参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "userId参数值不能少于0", groups = {create.class, update.class})
    private Long userId;

    @NotNull(message = "terminal参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "terminal参数值不能少于0", groups = {create.class, update.class})
    private Integer terminal;

    @NotNull(message = "token参数缺失", groups = {create.class, update.class})
    @Length(max = 32, message = "token参数不能超出32个字符", groups = {create.class, update.class})
    private String token;

    @NotNull(message = "expireTime参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "expireTime参数值不能少于0", groups = {create.class, update.class})
    private Integer expireTime;

}
